home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume4 / uemacs / part4 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  55.9 KB

  1. From: genrad!decvax!minow (Martin Minow)
  2. Subject: Microemacs (Part 4 of 6)
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 4, Issue 71
  7. Submitted by: decvax!minow (Martin Minow)
  8.  
  9. #! /bin/sh
  10. # This is a shell archive, meaning:
  11. # 1. Remove everything above the #! /bin/sh line.
  12. # 2. Save the resulting text in a file.
  13. # 3. Execute the file with /bin/sh (not csh) to create the files:
  14. #    sys
  15. # This archive created: Sun Apr 13 11:17:16 1986
  16. export PATH; PATH=/bin:$PATH
  17. if test ! -d 'sys'
  18. then
  19.     echo shar: creating directory "'sys'"
  20.     mkdir 'sys'
  21. fi
  22. if test ! -d 'sys/atari'
  23. then
  24.     echo shar: creating directory "'sys/atari'"
  25.     mkdir 'sys/atari'
  26. fi
  27. echo shar: extracting "'sys/atari/c.bat'" '(133 characters)'
  28. if test -f 'sys/atari/c.bat'
  29. then
  30.     echo shar: will not over-write existing file "'sys/atari/c.bat'"
  31. else
  32. cat << \SHAR_EOF > 'sys/atari/c.bat'
  33. a:cp68 -i a: %1.c %1.i
  34. a:c068 %1.i %1.1 %1.2 %1.3 -f
  35. a:rm %1.i
  36. a:c168 %1.1 %1.2 %1.s
  37. a:rm %1.1
  38. a:rm %1.2
  39. a:as68 -l -u %1.s
  40. a:rm %1.s
  41. SHAR_EOF
  42. if test 133 -ne "`wc -c < 'sys/atari/c.bat'`"
  43. then
  44.     echo shar: error transmitting "'sys/atari/c.bat'" '(should have been 133 characters)'
  45. fi
  46. fi
  47. echo shar: extracting "'sys/atari/fileio.c'" '(2956 characters)'
  48. if test -f 'sys/atari/fileio.c'
  49. then
  50.     echo shar: will not over-write existing file "'sys/atari/fileio.c'"
  51. else
  52. cat << \SHAR_EOF > 'sys/atari/fileio.c'
  53. /*
  54.  * Name:    MicroEMACS
  55.  *        Atari 520ST file I/O.
  56.  * Version:    30
  57.  * Last edit:    22-Feb-86
  58.  * By:        rex::conroy
  59.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  60.  */
  61. #include    "def.h"
  62.  
  63. extern    FILE    *fopen();
  64. static    FILE    *ffp;
  65.  
  66. /*
  67.  * Open a file for reading.
  68.  */
  69. ffropen(fn)
  70. char    *fn;
  71. {
  72.     ffp = fopen(fn, "r");
  73.     adjustcase(fn);
  74.     if (ffp == NULL)
  75.         return (FIOFNF);
  76.     return (FIOSUC);
  77. }
  78.  
  79. /*
  80.  * Open a file for writing.
  81.  * Return TRUE if all is well, and
  82.  * FALSE on error (cannot create).
  83.  */
  84. ffwopen(fn)
  85. char    *fn;
  86. {
  87.     ffp = fopen(fn, "w");
  88.     adjustcase(fn);
  89.     if (ffp == NULL) {
  90.         eprintf("Cannot open file for writing");
  91.         return (FIOERR);
  92.     }
  93.     return (FIOSUC);
  94. }
  95.  
  96. /*
  97.  * Close a file.
  98.  * Should look at the status.
  99.  */
  100. ffclose()
  101. {
  102.     fclose(ffp);
  103.     return (FIOSUC);
  104. }
  105.  
  106. /*
  107.  * Write a line to the already
  108.  * opened file. The "buf" points to the
  109.  * buffer, and the "nbuf" is its length, less
  110.  * the free newline. Return the status.
  111.  * Check only at the newline.
  112.  */
  113. ffputline(buf, nbuf)
  114. register char    buf[];
  115. {
  116.     register int    i;
  117.  
  118.     for (i=0; i<nbuf; ++i)
  119.         putc(buf[i]&0xFF, ffp);
  120.     putc('\n', ffp);
  121.     if (ferror(ffp) != FALSE) {
  122.         eprintf("Write I/O error");
  123.         return (FIOERR);
  124.     }
  125.     return (FIOSUC);
  126. }
  127.  
  128. /*
  129.  * Read a line from a file, and store the bytes
  130.  * in the supplied buffer. Stop on end of file or end of
  131.  * line. Don't get upset by files that don't have an end of
  132.  * line on the last line; this seem to be common on CP/M-86 and
  133.  * MS-DOS (the suspected culprit is VAX/VMS kermit, but this
  134.  * has not been confirmed. If this is sufficiently researched
  135.  * it may be possible to pull this kludge). Delete any CR
  136.  * followed by an LF. This is mainly for runoff documents,
  137.  * both on VMS and on Ultrix (they get copied over from
  138.  * VMS systems with DECnet).
  139.  */
  140. ffgetline(buf, nbuf)
  141. register char    buf[];
  142. {
  143.     register int    c;
  144.     register int    i;
  145.  
  146.     i = 0;
  147.     for (;;) {
  148.         c = getc(ffp);
  149.         if (c == '\r') {        /* Delete any non-stray    */
  150.             c = getc(ffp);        /* carriage returns.    */
  151.             if (c != '\n') {
  152.                 if (i >= nbuf-1) {
  153.                     eprintf("File has long line");
  154.                     return (FIOERR);
  155.                 }
  156.                 buf[i++] = '\r';
  157.             }
  158.         }
  159.         if (c==EOF || c=='\n')        /* End of line.        */
  160.             break;
  161.         if (i >= nbuf-1) {
  162.             eprintf("File has long line");
  163.             return (FIOERR);
  164.         }
  165.         buf[i++] = c;
  166.     }
  167.     if (c == EOF) {                /* End of file.        */
  168.         if (ferror(ffp) != FALSE) {
  169.             eprintf("File read error");
  170.             return (FIOERR);
  171.         }
  172.         if (i == 0)            /* Don't get upset if    */
  173.             return (FIOEOF);    /* no newline at EOF.    */
  174.     }
  175.     buf[i] = 0;
  176.     return (FIOSUC);
  177. }
  178.  
  179. /*
  180.  * Finish this routine when you decide
  181.  * what the right thing to do when renaming a
  182.  * file for backup purposes.
  183.  */
  184. fbackupfile(fname)
  185. char    *fname;
  186. {
  187.     return (TRUE);
  188. }
  189.  
  190. /*
  191.  * Zap file name to lower case, since
  192.  * the system on the 520ST has case insensitive
  193.  * file names, and lower looks better in the
  194.  * modelines than upper.
  195.  */
  196. adjustcase(fn)
  197. register char    *fn;
  198. {
  199.     register int    c;
  200.  
  201.     while ((c = *fn) != 0) {
  202.         if (ISUPPER(c) != FALSE)
  203.             *fn = TOLOWER(c);
  204.         ++fn;
  205.     }
  206. }
  207. SHAR_EOF
  208. if test 2956 -ne "`wc -c < 'sys/atari/fileio.c'`"
  209. then
  210.     echo shar: error transmitting "'sys/atari/fileio.c'" '(should have been 2956 characters)'
  211. fi
  212. fi
  213. echo shar: extracting "'sys/atari/getn.s'" '(583 characters)'
  214. if test -f 'sys/atari/getn.s'
  215. then
  216.     echo shar: will not over-write existing file "'sys/atari/getn.s'"
  217. else
  218. cat << \SHAR_EOF > 'sys/atari/getn.s'
  219. * Routines to read the size of the display.
  220. * MicroEMACS works even on a screen that has been blessed
  221. * by the "hi50" program.
  222. * MicroEMACS version 30, for the Atari.
  223.  
  224.     .text
  225.  
  226. * getnrow() -- get number of rows.
  227.  
  228.     .globl    _getnrow
  229.  
  230. _getnrow:
  231.  
  232.     move.l    a2, -(sp)
  233.     move.l    d2, -(sp)
  234.     dc.w    $A000
  235.     move.l    (sp)+, d2
  236.     movea.l    (sp)+, a2
  237.  
  238.     move.w    -42(a0), d0
  239.     addq.w    #1, d0
  240.     ext.l    d0
  241.  
  242.     rts
  243.  
  244. * getncol() -- get number of columns.
  245.  
  246.     .globl    _getncol
  247.  
  248. _getncol:
  249.     move.l    a2, -(sp)
  250.     move.l    d2, -(sp)
  251.     dc.w    $A000
  252.     move.l    (sp)+, d2
  253.     movea.l    (sp)+, a2
  254.  
  255.     move.w    -44(a0), d0
  256.     addq.w    #1, d0
  257.     ext.l    d0
  258.  
  259.     rts
  260. SHAR_EOF
  261. if test 583 -ne "`wc -c < 'sys/atari/getn.s'`"
  262. then
  263.     echo shar: error transmitting "'sys/atari/getn.s'" '(should have been 583 characters)'
  264. fi
  265. fi
  266. echo shar: extracting "'sys/atari/spawn.c'" '(423 characters)'
  267. if test -f 'sys/atari/spawn.c'
  268. then
  269.     echo shar: will not over-write existing file "'sys/atari/spawn.c'"
  270. else
  271. cat << \SHAR_EOF > 'sys/atari/spawn.c'
  272. /*
  273.  * Name:    MicroEMACS
  274.  *        Atari 520ST CLI spawn.
  275.  * Version:    30
  276.  * Last edit:    22-Feb-86
  277.  * By:        rex::conroy
  278.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  279.  */
  280. #include    "def.h"
  281.  
  282. /*
  283.  * Spawn CLI. Since MicroEMACS wants to hold
  284.  * a lot of memory, this may never be made to work right
  285.  * in GEMDOS. On the other hand, it sure would be a
  286.  * nice thing to have.
  287.  */
  288. spawncli(f, n, k)
  289. {
  290.     eprintf("Not in GEMDOS");
  291.     return (FALSE);
  292. }
  293. SHAR_EOF
  294. if test 423 -ne "`wc -c < 'sys/atari/spawn.c'`"
  295. then
  296.     echo shar: error transmitting "'sys/atari/spawn.c'" '(should have been 423 characters)'
  297. fi
  298. fi
  299. echo shar: extracting "'sys/atari/sysdef.h'" '(721 characters)'
  300. if test -f 'sys/atari/sysdef.h'
  301. then
  302.     echo shar: will not over-write existing file "'sys/atari/sysdef.h'"
  303. else
  304. cat << \SHAR_EOF > 'sys/atari/sysdef.h'
  305. /*
  306.  * Name:    MicroEMACS
  307.  *        Atari 520ST header file.
  308.  * Version:    30
  309.  * Last edit:    22-Feb-86
  310.  * By:        rex::conroy
  311.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  312.  */
  313. #define    PCC    1            /* "[]" gets an error.        */
  314. #define    KBLOCK    512            /* Kill grow.            */
  315. #define    GOOD    0            /* Good exit status.        */
  316.  
  317. /*
  318.  * For "(void)" casts.
  319.  */
  320. typedef    int    void;
  321.  
  322. /*
  323.  * Macros used by the buffer name making code.
  324.  * Start at the end of the file name, scan to the left
  325.  * until BDC1 (or BDC2, if defined) is reached. The buffer
  326.  * name starts just to the right of that location, and
  327.  * stops at end of string (or at the next BDC3 character,
  328.  * if defined). BDC2 and BDC3 are mainly for VMS.
  329.  */
  330. #define    BDC1    '\\'            /* Buffer names.        */
  331. #define    BDC2    ':'
  332. SHAR_EOF
  333. if test 721 -ne "`wc -c < 'sys/atari/sysdef.h'`"
  334. then
  335.     echo shar: error transmitting "'sys/atari/sysdef.h'" '(should have been 721 characters)'
  336. fi
  337. fi
  338. echo shar: extracting "'sys/atari/ttyio.c'" '(714 characters)'
  339. if test -f 'sys/atari/ttyio.c'
  340. then
  341.     echo shar: will not over-write existing file "'sys/atari/ttyio.c'"
  342. else
  343. cat << \SHAR_EOF > 'sys/atari/ttyio.c'
  344. /*
  345.  * Name:    MicroEMACS
  346.  *        Atari 520ST terminal I/O.
  347.  * Version:    30
  348.  * Last edit:    05-Feb-86
  349.  * By:        rex::conroy
  350.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  351.  */
  352. #include    "def.h"
  353. #include    <osbind.h>
  354.  
  355. int    nrow;                /* Terminal size, rows.        */
  356. int    ncol;                /* Terminal size, columns.    */
  357.  
  358. /*
  359.  * Open. Determine the size of
  360.  * the display by calling the assembly
  361.  * language "getnrow" and "getncol"
  362.  * routines.
  363.  */
  364. ttopen()
  365. {
  366.     nrow = getnrow();
  367.     if (nrow > NROW)
  368.         nrow = NROW;
  369.     ncol = getncol();
  370.     if (ncol > NCOL)
  371.         ncol = NCOL;
  372. }
  373. /*
  374.  * No-op.
  375.  */
  376. ttclose()
  377. {
  378. }
  379.  
  380. /*
  381.  * Put character.
  382.  */
  383. ttputc(c)
  384. {
  385.     Crawio(c & 0x7F);
  386. }
  387.  
  388. /*
  389.  * No-op.
  390.  */
  391. ttflush()
  392. {
  393. }
  394.  
  395. /*
  396.  * Get characters.
  397.  */
  398. ttgetc()
  399. {
  400.     return (Crawcin() & 0x7F);
  401. }
  402. SHAR_EOF
  403. if test 714 -ne "`wc -c < 'sys/atari/ttyio.c'`"
  404. then
  405.     echo shar: error transmitting "'sys/atari/ttyio.c'" '(should have been 714 characters)'
  406. fi
  407. fi
  408. echo shar: extracting "'sys/atari/xemacs.bat'" '(74 characters)'
  409. if test -f 'sys/atari/xemacs.bat'
  410. then
  411.     echo shar: will not over-write existing file "'sys/atari/xemacs.bat'"
  412. else
  413. cat << \SHAR_EOF > 'sys/atari/xemacs.bat'
  414. a:link68 [co[XEMACS.INP]]
  415. a:relmod XEMACS.68K XEMACS.TOS
  416. a:rm XEMACS.68K
  417.  
  418. SHAR_EOF
  419. if test 74 -ne "`wc -c < 'sys/atari/xemacs.bat'`"
  420. then
  421.     echo shar: error transmitting "'sys/atari/xemacs.bat'" '(should have been 74 characters)'
  422. fi
  423. fi
  424. echo shar: extracting "'sys/atari/xemacs.inp'" '(256 characters)'
  425. if test -f 'sys/atari/xemacs.inp'
  426. then
  427.     echo shar: will not over-write existing file "'sys/atari/xemacs.inp'"
  428. else
  429. cat << \SHAR_EOF > 'sys/atari/xemacs.inp'
  430. [U] XEMACS.68K=A:GEMS.O,
  431. BASIC.O,
  432. BUFFER.O,
  433. CINFO.O,
  434. DISPLAY.O,
  435. ECHO.O,
  436. EXTEND.O,
  437. FILE.O,
  438. FILEIO.O,
  439. GETN.O,
  440. KBD.O,
  441. LINE.O,
  442. MAIN.O,
  443. RANDOM.O,
  444. REGION.O,
  445. SEARCH.O,
  446. SPAWN.O,
  447. SYMBOL.O,
  448. TTY.O,
  449. TTYKBD.O,
  450. TTYIO.O,
  451. VERSION.O,
  452. WINDOW.O,
  453. WORD.O,
  454. A:OSBIND.O,
  455. A:GEMLIB
  456. SHAR_EOF
  457. if test 256 -ne "`wc -c < 'sys/atari/xemacs.inp'`"
  458. then
  459.     echo shar: error transmitting "'sys/atari/xemacs.inp'" '(should have been 256 characters)'
  460. fi
  461. fi
  462. echo shar: done with directory "'sys/atari'"
  463. if test ! -d 'sys/cpm86'
  464. then
  465.     echo shar: creating directory "'sys/cpm86'"
  466.     mkdir 'sys/cpm86'
  467. fi
  468. echo shar: extracting "'sys/cpm86/fileio.c'" '(3242 characters)'
  469. if test -f 'sys/cpm86/fileio.c'
  470. then
  471.     echo shar: will not over-write existing file "'sys/cpm86/fileio.c'"
  472. else
  473. cat << \SHAR_EOF > 'sys/cpm86/fileio.c'
  474. /*
  475.  * Name:    MicroEMACS
  476.  *        CP/M-86 file I/O.
  477.  * Version:    29
  478.  * Last edit:    05-Feb-86
  479.  * By:        rex::conroy
  480.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  481.  */
  482. #include    "def.h"
  483.  
  484. static    FILE    *ffp;
  485.  
  486. /*
  487.  * Open a file for reading.
  488.  */
  489. ffropen(fn)
  490. char    *fn;
  491. {
  492.     if ((ffp=fopen(fn, "r")) == NULL)
  493.         return (FIOFNF);
  494.     return (FIOSUC);
  495. }
  496.  
  497. /*
  498.  * Open a file for writing.
  499.  * Return TRUE if all is well, and
  500.  * FALSE on error (cannot create).
  501.  */
  502. ffwopen(fn)
  503. char    *fn;
  504. {
  505.     if ((ffp=fopen(fn, "w")) == NULL) {
  506.         eprintf("Cannot open file for writing");
  507.         return (FIOERR);
  508.     }
  509.     return (FIOSUC);
  510. }
  511.  
  512. /*
  513.  * Close a file.
  514.  * Should look at the status.
  515.  */
  516. ffclose()
  517. {
  518.     fclose(ffp);
  519.     return (FIOSUC);
  520. }
  521.  
  522. /*
  523.  * Write a line to the already
  524.  * opened file. The "buf" points to the
  525.  * buffer, and the "nbuf" is its length, less
  526.  * the free newline. Return the status.
  527.  * Check only at the newline.
  528.  */
  529. ffputline(buf, nbuf)
  530. register char    buf[];
  531. {
  532.     register int    i;
  533.  
  534.     for (i=0; i<nbuf; ++i)
  535.         putc(buf[i]&0xFF, ffp);
  536.     putc('\n', ffp);
  537.     if (ferror(ffp) != FALSE) {
  538.         eprintf("Write I/O error");
  539.         return (FIOERR);
  540.     }
  541.     return (FIOSUC);
  542. }
  543.  
  544. /*
  545.  * Read a line from a file, and store the bytes
  546.  * in the supplied buffer. Stop on end of file or end of
  547.  * line. Don't get upset by files that don't have an end of
  548.  * line on the last line; this seem to be common on CP/M-86 and
  549.  * MS-DOS (the suspected culprit is VAX/VMS kermit, but this
  550.  * has not been confirmed. If this is sufficiently researched
  551.  * it may be possible to pull this kludge). Delete any CR
  552.  * followed by an LF. This is mainly for runoff documents,
  553.  * both on VMS and on Ultrix (they get copied over from
  554.  * VMS systems with DECnet).
  555.  */
  556. ffgetline(buf, nbuf)
  557. register char    buf[];
  558. {
  559.     register int    c;
  560.     register int    i;
  561.  
  562.     i = 0;
  563.     for (;;) {
  564.         c = getc(ffp);
  565.         if (c == '\r') {        /* Delete any non-stray    */
  566.             c = getc(ffp);        /* carriage returns.    */
  567.             if (c != '\n') {
  568.                 if (i >= nbuf-1) {
  569.                     eprintf("File has long line");
  570.                     return (FIOERR);
  571.                 }
  572.                 buf[i++] = '\r';
  573.             }
  574.         }
  575.         if (c==EOF || c=='\n')        /* End of line.        */
  576.             break;
  577.         if (i >= nbuf-1) {
  578.             eprintf("File has long line");
  579.             return (FIOERR);
  580.         }
  581.         buf[i++] = c;
  582.     }
  583.     if (c == EOF) {                /* End of file.        */
  584.         if (ferror(ffp) != FALSE) {
  585.             eprintf("File read error");
  586.             return (FIOERR);
  587.         }
  588.         if (i == 0)            /* Don't get upset if    */
  589.             return (FIOEOF);    /* no newline at EOF.    */
  590.     }
  591.     buf[i] = 0;
  592.     return (FIOSUC);
  593. }
  594.  
  595. /*
  596.  * Some CP/M-86 user should figure out
  597.  * the right rules for backup file names, and make
  598.  * this work. I don't use CP/M-86, so I cannot figure
  599.  * out the right rules. Return TRUE so the callers
  600.  * don't abort writes.
  601.  */
  602. fbackupfile(fname)
  603. char    *fname;
  604. {
  605.     return (TRUE);                /* Hack.        */
  606. }
  607.  
  608. /*
  609.  * The string "fn" is a file name.
  610.  * Perform any required case adjustments. All sustems
  611.  * we deal with so far have case insensitive file systems.
  612.  * We zap everything to lower case. The problem we are trying
  613.  * to solve is getting 2 buffers holding the same file if
  614.  * you visit one of them with the "caps lock" key down.
  615.  * On UNIX file names are dual case, so we leave
  616.  * everything alone.
  617.  */
  618. adjustcase(fn)
  619. register char    *fn;
  620. {
  621.     register int    c;
  622.  
  623.     while ((c = *fn) != 0) {
  624.         if (c>='A' && c<='Z')
  625.             *fn = c + 'a' - 'A';
  626.         ++fn;
  627.     }
  628. }
  629. SHAR_EOF
  630. if test 3242 -ne "`wc -c < 'sys/cpm86/fileio.c'`"
  631. then
  632.     echo shar: error transmitting "'sys/cpm86/fileio.c'" '(should have been 3242 characters)'
  633. fi
  634. fi
  635. echo shar: extracting "'sys/cpm86/spawn.c'" '(466 characters)'
  636. if test -f 'sys/cpm86/spawn.c'
  637. then
  638.     echo shar: will not over-write existing file "'sys/cpm86/spawn.c'"
  639. else
  640. cat << \SHAR_EOF > 'sys/cpm86/spawn.c'
  641. /*
  642.  * Name:    MicroEMACS
  643.  *        CP/M-86 spawn a sub-CLI (ha-ha).
  644.  * Version:    29
  645.  * Last edit:    05-Feb-86
  646.  * By:        rex::conroy
  647.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  648.  */
  649. #include    "def.h"
  650.  
  651. /*
  652.  * Create a subjob with a copy
  653.  * of the command intrepreter in it. When the
  654.  * command interpreter exits, mark the screen as
  655.  * garbage so that you do a full repaint. Bound
  656.  * to "C-C" and called from "C-Z".
  657.  */
  658. spawncli(f, n, k)
  659. {
  660.     eprintf("Not in CP/M-86");
  661.     return (FALSE);
  662. }
  663. SHAR_EOF
  664. if test 466 -ne "`wc -c < 'sys/cpm86/spawn.c'`"
  665. then
  666.     echo shar: error transmitting "'sys/cpm86/spawn.c'" '(should have been 466 characters)'
  667. fi
  668. fi
  669. echo shar: extracting "'sys/cpm86/sysdef.h'" '(571 characters)'
  670. if test -f 'sys/cpm86/sysdef.h'
  671. then
  672.     echo shar: will not over-write existing file "'sys/cpm86/sysdef.h'"
  673. else
  674. cat << \SHAR_EOF > 'sys/cpm86/sysdef.h'
  675. /*
  676.  * Name:    MicroEMACS
  677.  *        CP/M-86 system header file.
  678.  * Version:    29
  679.  * Last edit:    05-Feb-86
  680.  * By:        rex::conroy
  681.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  682.  */
  683. #define    PCC    0            /* "[]" will work.        */
  684.  
  685. /*
  686.  * Macros used by the buffer name making code.
  687.  * Start at the end of the file name, scan to the left
  688.  * until BDC1 (or BDC2, if defined) is reached. The buffer
  689.  * name starts just to the right of that location, and
  690.  * stops at end of string (or at the next BDC3 character,
  691.  * if defined). BDC2 and BDC3 are mainly for VMS.
  692.  */
  693. #define    BDC1    ':'            /* Buffer name.            */
  694. SHAR_EOF
  695. if test 571 -ne "`wc -c < 'sys/cpm86/sysdef.h'`"
  696. then
  697.     echo shar: error transmitting "'sys/cpm86/sysdef.h'" '(should have been 571 characters)'
  698. fi
  699. fi
  700. echo shar: extracting "'sys/cpm86/ttyio.c'" '(614 characters)'
  701. if test -f 'sys/cpm86/ttyio.c'
  702. then
  703.     echo shar: will not over-write existing file "'sys/cpm86/ttyio.c'"
  704. else
  705. cat << \SHAR_EOF > 'sys/cpm86/ttyio.c'
  706. /*
  707.  * Name:    MicroEMACS
  708.  *        CP/M-86 terminal I/O.
  709.  * Version:    29
  710.  * Last edit:    05-Feb-86
  711.  * By:        rex::conroy
  712.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  713.  */
  714. #include    "def.h"
  715.  
  716. #include    <bdos.h>
  717.  
  718. int    nrow;                /* Terminal size, rows.        */
  719. int    ncol;                /* Terminal size, columns.    */
  720.  
  721. /*
  722.  * Set up terminal.
  723.  * Almost no operation in CP/M-86.
  724.  */
  725. ttopen()
  726. {
  727.     nrow = NROW;
  728.     ncol = NCOL;
  729. }
  730.  
  731. /*
  732.  * No operation in CP/M-86.
  733.  */
  734. ttclose()
  735. {
  736. }
  737.  
  738. /*
  739.  * Write character.
  740.  */
  741. ttputc(c)
  742. {
  743.     bios(BCONOUT, c, 0);
  744. }
  745.  
  746. /*
  747.  * No operation on CP/M-86.
  748.  */
  749. ttflush()
  750. {
  751. }
  752.  
  753. /*
  754.  * Read character.
  755.  */
  756. ttgetc()
  757. {
  758.     return (biosb(BCONIN, 0, 0));
  759. }
  760. SHAR_EOF
  761. if test 614 -ne "`wc -c < 'sys/cpm86/ttyio.c'`"
  762. then
  763.     echo shar: error transmitting "'sys/cpm86/ttyio.c'" '(should have been 614 characters)'
  764. fi
  765. fi
  766. echo shar: done with directory "'sys/cpm86'"
  767. if test ! -d 'sys/ultrix'
  768. then
  769.     echo shar: creating directory "'sys/ultrix'"
  770.     mkdir 'sys/ultrix'
  771. fi
  772. echo shar: extracting "'sys/ultrix/Makefile'" '(873 characters)'
  773. if test -f 'sys/ultrix/Makefile'
  774. then
  775.     echo shar: will not over-write existing file "'sys/ultrix/Makefile'"
  776. else
  777. cat << \SHAR_EOF > 'sys/ultrix/Makefile'
  778. # Makefile for MicroEMACS.
  779. # Is there a better way to do the rebuilds, other than using
  780. # the links?
  781.  
  782. SYS    = ultrix
  783. TTY    = ansi
  784.  
  785. CFLAGS    = -O
  786.  
  787. OBJ =    basic.o \
  788.     buffer.o \
  789.     cinfo.o \
  790.     display.o \
  791.     echo.o \
  792.     extend.o \
  793.     file.o \
  794.     kbd.o \
  795.     line.o \
  796.     main.o \
  797.     random.o \
  798.     region.o \
  799.     search.o \
  800.     symbol.o \
  801.     version.o \
  802.     window.o \
  803.     word.o \
  804.     fileio.o \
  805.     spawn.o \
  806.     ttyio.o \
  807.     tty.o \
  808.     ttykbd.o
  809.  
  810. xemacs:        $(OBJ)
  811.     cc -o xemacs $(OBJ)
  812.  
  813. $(OBJ):        def.h sysdef.h ttydef.h
  814.  
  815. sysdef.h:    sys/$(SYS)/sysdef.h    # Update links, if needed.
  816.     ln sys/$(SYS)/sysdef.h .
  817.  
  818. ttydef.h:    tty/$(TTY)/ttydef.h
  819.     ln tty/$(TTY)/ttydef.h .
  820.  
  821. fileio.c:    sys/$(SYS)/fileio.c
  822.     ln sys/$(SYS)/fileio.c .
  823.  
  824. spawn.c:    sys/$(SYS)/spawn.c
  825.     ln sys/$(SYS)/spawn.c .
  826.  
  827. tty.c:        tty/$(TTY)/tty.c
  828.     ln tty/$(TTY)/tty.c .
  829.  
  830. ttyio.c:    sys/$(SYS)/ttyio.c
  831.     ln sys/$(SYS)/ttyio.c .
  832.  
  833. ttykbd.c:    tty/$(TTY)/ttykbd.c
  834.     ln tty/$(TTY)/ttykbd.c .
  835. SHAR_EOF
  836. if test 873 -ne "`wc -c < 'sys/ultrix/Makefile'`"
  837. then
  838.     echo shar: error transmitting "'sys/ultrix/Makefile'" '(should have been 873 characters)'
  839. fi
  840. fi
  841. echo shar: extracting "'sys/ultrix/fileio.c'" '(3636 characters)'
  842. if test -f 'sys/ultrix/fileio.c'
  843. then
  844.     echo shar: will not over-write existing file "'sys/ultrix/fileio.c'"
  845. else
  846. cat << \SHAR_EOF > 'sys/ultrix/fileio.c'
  847. /*
  848.  * Name:    MicroEMACS
  849.  *         Ultrix-32 file I/O.
  850.  * Version:    29
  851.  * Last edit:    05-Feb-86
  852.  * By:        rex::conroy
  853.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  854.  */
  855. #include    "def.h"
  856.  
  857. static    FILE    *ffp;
  858.  
  859. /*
  860.  * Open a file for reading.
  861.  */
  862. ffropen(fn)
  863. char    *fn;
  864. {
  865.     if ((ffp=fopen(fn, "r")) == NULL)
  866.         return (FIOFNF);
  867.     return (FIOSUC);
  868. }
  869.  
  870. /*
  871.  * Open a file for writing.
  872.  * Return TRUE if all is well, and
  873.  * FALSE on error (cannot create).
  874.  */
  875. ffwopen(fn)
  876. char    *fn;
  877. {
  878.     if ((ffp=fopen(fn, "w")) == NULL) {
  879.         eprintf("Cannot open file for writing");
  880.         return (FIOERR);
  881.     }
  882.     return (FIOSUC);
  883. }
  884.  
  885. /*
  886.  * Close a file.
  887.  * Should look at the status.
  888.  */
  889. ffclose()
  890. {
  891.     fclose(ffp);
  892.     return (FIOSUC);
  893. }
  894.  
  895. /*
  896.  * Write a line to the already
  897.  * opened file. The "buf" points to the
  898.  * buffer, and the "nbuf" is its length, less
  899.  * the free newline. Return the status.
  900.  * Check only at the newline.
  901.  */
  902. ffputline(buf, nbuf)
  903. register char    buf[];
  904. {
  905.     register int    i;
  906.  
  907.     for (i=0; i<nbuf; ++i)
  908.         putc(buf[i]&0xFF, ffp);
  909.     putc('\n', ffp);
  910.     if (ferror(ffp) != FALSE) {
  911.         eprintf("Write I/O error");
  912.         return (FIOERR);
  913.     }
  914.     return (FIOSUC);
  915. }
  916.  
  917. /*
  918.  * Read a line from a file, and store the bytes
  919.  * in the supplied buffer. Stop on end of file or end of
  920.  * line. Don't get upset by files that don't have an end of
  921.  * line on the last line; this seem to be common on CP/M-86 and
  922.  * MS-DOS (the suspected culprit is VAX/VMS kermit, but this
  923.  * has not been confirmed. If this is sufficiently researched
  924.  * it may be possible to pull this kludge). Delete any CR
  925.  * followed by an LF. This is mainly for runoff documents,
  926.  * both on VMS and on Ultrix (they get copied over from
  927.  * VMS systems with DECnet).
  928.  */
  929. ffgetline(buf, nbuf)
  930. register char    buf[];
  931. {
  932.     register int    c;
  933.     register int    i;
  934.  
  935.     i = 0;
  936.     for (;;) {
  937.         c = getc(ffp);
  938.         if (c == '\r') {        /* Delete any non-stray    */
  939.             c = getc(ffp);        /* carriage returns.    */
  940.             if (c != '\n') {
  941.                 if (i >= nbuf-1) {
  942.                     eprintf("File has long line");
  943.                     return (FIOERR);
  944.                 }
  945.                 buf[i++] = '\r';
  946.             }
  947.         }
  948.         if (c==EOF || c=='\n')        /* End of line.        */
  949.             break;
  950.         if (i >= nbuf-1) {
  951.             eprintf("File has long line");
  952.             return (FIOERR);
  953.         }
  954.         buf[i++] = c;
  955.     }
  956.     if (c == EOF) {                /* End of file.        */
  957.         if (ferror(ffp) != FALSE) {
  958.             eprintf("File read error");
  959.             return (FIOERR);
  960.         }
  961.         if (i == 0)            /* Don't get upset if    */
  962.             return (FIOEOF);    /* no newline at EOF.    */
  963.     }
  964.     buf[i] = 0;
  965.     return (FIOSUC);
  966. }
  967.  
  968. /*
  969.  * Rename the file "fname" into a backup
  970.  * copy. On Unix the backup has the same name as the
  971.  * original file, with a "~" on the end; this seems to
  972.  * be newest of the new-speak. The error handling is
  973.  * all in "file.c". The "unlink" is perhaps not the
  974.  * right thing here; I don't care that much as
  975.  * I don't enable backups myself.
  976.  */
  977. fbackupfile(fname)
  978. char    *fname;
  979. {
  980.     register char    *nname;
  981.  
  982.     if ((nname=malloc(strlen(fname)+1+1)) == NULL)
  983.         return (ABORT);
  984.     (void) strcpy(nname, fname);
  985.     (void) strcat(nname, "~");
  986.     (void) unlink(nname);            /* Ignore errors.    */
  987.     if (rename(fname, nname) < 0) {
  988.         free(nname);
  989.         return (FALSE);
  990.     }
  991.     free(nname);
  992.     return (TRUE);
  993. }
  994.  
  995. /*
  996.  * The string "fn" is a file name.
  997.  * Perform any required case adjustments. All sustems
  998.  * we deal with so far have case insensitive file systems.
  999.  * We zap everything to lower case. The problem we are trying
  1000.  * to solve is getting 2 buffers holding the same file if
  1001.  * you visit one of them with the "caps lock" key down.
  1002.  * On UNIX file names are dual case, so we leave
  1003.  * everything alone.
  1004.  */
  1005. adjustcase(fn)
  1006. register char    *fn;
  1007. {
  1008. #if    0
  1009.     register int    c;
  1010.  
  1011.     while ((c = *fn) != 0) {
  1012.         if (c>='A' && c<='Z')
  1013.             *fn = c + 'a' - 'A';
  1014.         ++fn;
  1015.     }
  1016. #endif
  1017. }
  1018. SHAR_EOF
  1019. if test 3636 -ne "`wc -c < 'sys/ultrix/fileio.c'`"
  1020. then
  1021.     echo shar: error transmitting "'sys/ultrix/fileio.c'" '(should have been 3636 characters)'
  1022. fi
  1023. fi
  1024. echo shar: extracting "'sys/ultrix/spawn.c'" '(2731 characters)'
  1025. if test -f 'sys/ultrix/spawn.c'
  1026. then
  1027.     echo shar: will not over-write existing file "'sys/ultrix/spawn.c'"
  1028. else
  1029. cat << \SHAR_EOF > 'sys/ultrix/spawn.c'
  1030. /*
  1031.  * Name:    MicroEMACS
  1032.  *        Spawn CLI; stop if C shell.
  1033.  * Version:    29
  1034.  * Last edit:    10-Feb-86
  1035.  * By:        rex::conroy
  1036.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1037.  *
  1038.  * Spawn. New version, which
  1039.  * interracts with the job control stuff
  1040.  * in the 4.X BSD C shell.
  1041.  */
  1042. #include    "def.h"
  1043.  
  1044. #include    <sgtty.h>
  1045. #include    <signal.h>
  1046.  
  1047. char    *shellp    = NULL;            /* Saved "SHELL" name.        */
  1048.  
  1049. extern    struct    sgttyb    oldtty;        /* There really should be a    */
  1050. extern    struct    sgttyb    newtty;        /* nicer way of doing this, so    */
  1051. extern    struct    sgttyb    oldtchars;    /* spawn does not need to know    */
  1052. extern    struct    sgttyb    newtchars;    /* about the insides of the    */
  1053. extern    struct    sgttyb    oldltchars;    /* terminal I/O code.        */
  1054. extern    struct    sgttyb    newltchars;
  1055.  
  1056. extern    char    *getenv();
  1057.  
  1058. /*
  1059.  * This code does a one of 2 different
  1060.  * things, depending on what version of the shell
  1061.  * you are using. If you are using the C shell, which
  1062.  * implies that you are using job control, then MicroEMACS
  1063.  * moves the cursor to a nice place and sends itself a
  1064.  * stop signal. If you are using the Bourne shell it runs
  1065.  * a subshell using fork/exec. Bound to "C-C", and used
  1066.  * as a subcommand by "C-Z".
  1067.  */
  1068. spawncli(f, n, k)
  1069. {
  1070.     register int    pid;
  1071.     register int    wpid;
  1072.     register int    (*oqsig)();
  1073.     register int    (*oisig)();
  1074.     int        status;
  1075.  
  1076.     if (shellp == NULL) {
  1077.         shellp = getenv("SHELL");
  1078.         if (shellp == NULL)
  1079.             shellp = getenv("shell");
  1080.         if (shellp == NULL)
  1081.             shellp = "/bin/sh";    /* Safer.        */
  1082.     }
  1083.     ttcolor(CTEXT);
  1084.     ttnowindow();
  1085.     if (strcmp(shellp, "/bin/csh") == 0) {
  1086.         if (epresf != FALSE) {
  1087.             ttmove(nrow-1, 0);
  1088.             tteeol();
  1089.             epresf = FALSE;
  1090.         }                /* Csh types a "\n"    */
  1091.         ttmove(nrow-2, 0);        /* before "Stopped".    */
  1092.     } else {
  1093.         ttmove(nrow-1, 0);
  1094.         if (epresf != FALSE) {
  1095.             tteeol();
  1096.             epresf = FALSE;
  1097.         }
  1098.     }
  1099.     ttflush();
  1100.     if (ioctl(0, TIOCSLTC, &oldltchars) < 0
  1101.     ||  ioctl(0, TIOCSETC, &oldtchars)  < 0
  1102.     ||  ioctl(0, TIOCSETP, &oldtty)     < 0) {
  1103.         eprintf("IOCTL #1 to terminal failed");
  1104.         return (FALSE);
  1105.     }
  1106.     if (strcmp(shellp, "/bin/csh") == 0)    /* C shell.        */
  1107.         kill(0, SIGTSTP);
  1108.     else {                    /* Bourne shell.    */
  1109.         oqsig = signal(SIGQUIT, SIG_IGN);
  1110.         oisig = signal(SIGINT,  SIG_IGN);
  1111.         if ((pid=fork()) < 0) {
  1112.             signal(SIGQUIT, oqsig);
  1113.             signal(SIGINT,  oisig);
  1114.             eprintf("Failed to create process");
  1115.             return (FALSE);
  1116.         }
  1117.         if (pid == 0) {
  1118.             execl(shellp, "sh", "-i", NULL);
  1119.             _exit(0);        /* Should do better!    */
  1120.         }
  1121.         while ((wpid=wait(&status))>=0 && wpid!=pid)
  1122.             ;
  1123.         signal(SIGQUIT, oqsig);
  1124.         signal(SIGINT,  oisig);
  1125.     }
  1126.     sgarbf = TRUE;                /* Force repaint.    */
  1127.     if (ioctl(0, TIOCSETP, &newtty)     < 0
  1128.     ||  ioctl(0, TIOCSETC, &newtchars)  < 0
  1129.     ||  ioctl(0, TIOCSLTC, &newltchars) < 0) {
  1130.         eprintf("IOCTL #2 to terminal failed");
  1131.         return (FALSE);
  1132.     }
  1133.     return (TRUE);
  1134. }
  1135. SHAR_EOF
  1136. if test 2731 -ne "`wc -c < 'sys/ultrix/spawn.c'`"
  1137. then
  1138.     echo shar: error transmitting "'sys/ultrix/spawn.c'" '(should have been 2731 characters)'
  1139. fi
  1140. fi
  1141. echo shar: extracting "'sys/ultrix/sysdef.h'" '(660 characters)'
  1142. if test -f 'sys/ultrix/sysdef.h'
  1143. then
  1144.     echo shar: will not over-write existing file "'sys/ultrix/sysdef.h'"
  1145. else
  1146. cat << \SHAR_EOF > 'sys/ultrix/sysdef.h'
  1147. /*
  1148.  * Name:    MicroEMACS
  1149.  *        Ultrix-32 system header file.
  1150.  * Version:    29
  1151.  * Last edit:    05-Feb-86
  1152.  * By:        rex::conroy
  1153.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1154.  */
  1155. #define    PCC    1            /* "[]" gets an error.        */
  1156. #define    KBLOCK    8192            /* Kill grow.            */
  1157. #define    GOOD    0            /* Good exit status.        */
  1158.  
  1159. /*
  1160.  * Macros used by the buffer name making code.
  1161.  * Start at the end of the file name, scan to the left
  1162.  * until BDC1 (or BDC2, if defined) is reached. The buffer
  1163.  * name starts just to the right of that location, and
  1164.  * stops at end of string (or at the next BDC3 character,
  1165.  * if defined). BDC2 and BDC3 are mainly for VMS.
  1166.  */
  1167. #define    BDC1    '/'            /* Buffer names.        */
  1168. SHAR_EOF
  1169. if test 660 -ne "`wc -c < 'sys/ultrix/sysdef.h'`"
  1170. then
  1171.     echo shar: error transmitting "'sys/ultrix/sysdef.h'" '(should have been 660 characters)'
  1172. fi
  1173. fi
  1174. echo shar: extracting "'sys/ultrix/ttyio.c'" '(3900 characters)'
  1175. if test -f 'sys/ultrix/ttyio.c'
  1176. then
  1177.     echo shar: will not over-write existing file "'sys/ultrix/ttyio.c'"
  1178. else
  1179. cat << \SHAR_EOF > 'sys/ultrix/ttyio.c'
  1180. /*
  1181.  * Name:    MicroEMACS
  1182.  *        Ultrix-32 terminal I/O.
  1183.  * Version:    29
  1184.  * Last edit:    05-Feb-86
  1185.  * By:        rex::conroy
  1186.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1187.  *
  1188.  * The functions in this file
  1189.  * negotiate with the operating system for
  1190.  * keyboard characters, and write characters to
  1191.  * the display in a barely buffered fashion.
  1192.  */
  1193. #include    "def.h"
  1194.  
  1195. #include    <sgtty.h>
  1196.  
  1197. #define    NOBUF    512            /* Output buffer size.        */
  1198.  
  1199. char    obuf[NOBUF];            /* Output buffer.        */
  1200. int    nobuf;
  1201. struct    sgttyb    oldtty;            /* V6/V7 stty data.        */
  1202. struct    sgttyb    newtty;
  1203. struct    tchars    oldtchars;        /* V7 editing.            */
  1204. struct    tchars    newtchars;
  1205. struct    ltchars oldltchars;        /* 4.2 BSD editing.        */
  1206. struct    ltchars    newltchars;
  1207. int    nrow;                /* Terminal size, rows.        */
  1208. int    ncol;                /* Terminal size, columns.    */
  1209.  
  1210. /*
  1211.  * This function gets called once, to set up
  1212.  * the terminal channel. On Ultrix is's tricky, since
  1213.  * we want flow control, but we don't want any characters
  1214.  * stolen to send signals. Use CBREAK mode, and set all
  1215.  * characters but start and stop to 0xFF.
  1216.  */
  1217. ttopen()
  1218. {
  1219.     register char    *cp;
  1220.     extern char    *getenv();
  1221.  
  1222.     if (ioctl(0, TIOCGETP, &oldtty) < 0)
  1223.         abort();
  1224.     newtty.sg_ospeed = oldtty.sg_ospeed;
  1225.     newtty.sg_ispeed = oldtty.sg_ispeed;
  1226.     newtty.sg_erase  = oldtty.sg_erase;
  1227.     newtty.sg_kill   = oldtty.sg_kill;
  1228.     newtty.sg_flags  = oldtty.sg_flags;
  1229.     newtty.sg_flags &= ~(ECHO|CRMOD);    /* Kill echo, CR=>NL.    */
  1230.     newtty.sg_flags |= CBREAK;        /* Half-cooked mode.    */
  1231.     if (ioctl(0, TIOCSETP, &newtty) < 0)
  1232.         abort();
  1233.     if (ioctl(0, TIOCGETC, &oldtchars) < 0)
  1234.         abort();
  1235.     newtchars.t_intrc  = 0xFF;        /* Interrupt.        */
  1236.     newtchars.t_quitc  = 0xFF;        /* Quit.        */
  1237.     newtchars.t_startc = 0x11;        /* ^Q, for terminal.    */
  1238.     newtchars.t_stopc  = 0x13;        /* ^S, for terminal.    */
  1239.     newtchars.t_eofc   = 0xFF;
  1240.     newtchars.t_brkc   = 0xFF;
  1241.     if (ioctl(0, TIOCSETC, &newtchars) < 0)
  1242.         abort();
  1243.     if (ioctl(0, TIOCGLTC, &oldltchars) < 0)
  1244.         abort();
  1245.     newltchars.t_suspc  = 0xFF;        /* Suspend #1.        */
  1246.     newltchars.t_dsuspc = 0xFF;        /* Suspend #2.        */
  1247.     newltchars.t_rprntc = 0xFF;
  1248.     newltchars.t_flushc = 0xFF;        /* Output flush.    */
  1249.     newltchars.t_werasc = 0xFF;
  1250.     newltchars.t_lnextc = 0xFF;        /* Literal next.    */
  1251.     if (ioctl(0, TIOCSLTC, &newltchars) < 0)
  1252.         abort();
  1253.     if ((cp=getenv("TERMCAP")) == NULL
  1254.     || (nrow=getvalue(cp, "li")) <= 0
  1255.     || (ncol=getvalue(cp, "co")) <= 0) {
  1256.         nrow = 24;
  1257.         ncol = 80;
  1258.     }
  1259.     if (nrow > NROW)            /* Don't crash if the    */
  1260.         nrow = NROW;            /* termcap entry is    */
  1261.     if (ncol > NCOL)            /* too big.        */
  1262.         ncol = NCOL;
  1263. }
  1264.  
  1265. /*
  1266.  * This routine scans a string, which is
  1267.  * actually the return value of a getenv call for the TERMCAP
  1268.  * variable, looking for numeric parameter "name". Return the value
  1269.  * if found. Return -1 if not there. Assume that "name" is 2
  1270.  * characters long. This limited use of the TERMCAP lets us find
  1271.  * out the size of a window on the X display.
  1272.  */
  1273. getvalue(cp, name)
  1274. register char    *cp;
  1275. register char    *name;
  1276. {
  1277.     for (;;) {
  1278.         while (*cp!=0 && *cp!=':')
  1279.             ++cp;
  1280.         if (*cp++ == 0)            /* Not found.        */
  1281.             return (-1);
  1282.         if (cp[0]==name[0] && cp[1]==name[1] && cp[2]=='#')
  1283.             return (atoi(cp+3));    /* Stops on ":".    */
  1284.     }
  1285. }
  1286.  
  1287. /*
  1288.  * This function gets called just
  1289.  * before we go back home to the shell. Put all of
  1290.  * the terminal parameters back.
  1291.  */
  1292. ttclose()
  1293. {
  1294.     ttflush();
  1295.     if (ioctl(0, TIOCSLTC, &oldltchars) < 0)
  1296.         abort();
  1297.     if (ioctl(0, TIOCSETC, &oldtchars) < 0)
  1298.         abort();
  1299.     if (ioctl(0, TIOCSETP, &oldtty) < 0)
  1300.         abort();
  1301. }
  1302.  
  1303. /*
  1304.  * Write character to the display.
  1305.  * Characters are buffered up, to make things
  1306.  * a little bit more efficient.
  1307.  */
  1308. ttputc(c)
  1309. {
  1310.     if (nobuf >= NOBUF)
  1311.         ttflush();
  1312.     obuf[nobuf++] = c;
  1313. }
  1314.  
  1315. /*
  1316.  * Flush output.
  1317.  */
  1318. ttflush()
  1319. {
  1320.     if (nobuf != 0) {
  1321.         write(1, obuf, nobuf);
  1322.         nobuf = 0;
  1323.     }
  1324. }
  1325.  
  1326. /*
  1327.  * Read character from terminal.
  1328.  * All 8 bits are returned, so that you can use
  1329.  * a multi-national terminal.
  1330.  */
  1331. ttgetc()
  1332. {
  1333.     char    buf[1];
  1334.  
  1335.     while (read(0, &buf[0], 1) != 1)
  1336.         ;
  1337.     return (buf[0] & 0xFF);
  1338. }
  1339. SHAR_EOF
  1340. if test 3900 -ne "`wc -c < 'sys/ultrix/ttyio.c'`"
  1341. then
  1342.     echo shar: error transmitting "'sys/ultrix/ttyio.c'" '(should have been 3900 characters)'
  1343. fi
  1344. fi
  1345. echo shar: done with directory "'sys/ultrix'"
  1346. if test ! -d 'sys/vms'
  1347. then
  1348.     echo shar: creating directory "'sys/vms'"
  1349.     mkdir 'sys/vms'
  1350. fi
  1351. echo shar: extracting "'sys/vms/fileio.c'" '(3410 characters)'
  1352. if test -f 'sys/vms/fileio.c'
  1353. then
  1354.     echo shar: will not over-write existing file "'sys/vms/fileio.c'"
  1355. else
  1356. cat << \SHAR_EOF > 'sys/vms/fileio.c'
  1357. /*
  1358.  * Name:    MicroEMACS
  1359.  * Version:    29
  1360.  *        VAX/VMS file I/O.
  1361.  * Last edit:    05-Feb-86
  1362.  * By:        rex::conroy
  1363.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1364.  *
  1365.  * Read and write ASCII files. All
  1366.  * of the low level file I/O knowledge is here.
  1367.  * VAX/VMS.
  1368.  * Pretty much vanilla standard I/O, using
  1369.  * the (traditional) funny open.
  1370.  */
  1371. #include    "def.h"
  1372.  
  1373. static    FILE    *ffp;
  1374.  
  1375. /*
  1376.  * Open a file for reading.
  1377.  */
  1378. ffropen(fn)
  1379. char    *fn;
  1380. {
  1381.     if ((ffp=fopen(fn, "r")) == NULL)
  1382.         return (FIOFNF);
  1383.     return (FIOSUC);
  1384. }
  1385.  
  1386. /*
  1387.  * Open a file for writing.
  1388.  * Return TRUE if all is well, and
  1389.  * FALSE on error (cannot create).
  1390.  */
  1391. ffwopen(fn)
  1392. char    *fn;
  1393. {
  1394.     register int    fd;
  1395.  
  1396.     if ((fd=creat(fn, 0, "rfm=var", "rat=cr")) < 0
  1397.     || (ffp=fdopen(fd, "w")) == NULL) {
  1398.         eprintf("Cannot open file for writing");
  1399.         return (FIOERR);
  1400.     }
  1401.     return (FIOSUC);
  1402. }
  1403.  
  1404. /*
  1405.  * Close a file.
  1406.  * Should look at the status.
  1407.  */
  1408. ffclose()
  1409. {
  1410.     fclose(ffp);
  1411.     return (FIOSUC);
  1412. }
  1413.  
  1414. /*
  1415.  * Write a line to the already
  1416.  * opened file. The "buf" points to the
  1417.  * buffer, and the "nbuf" is its length, less
  1418.  * the free newline. Return the status.
  1419.  * Check only at the newline.
  1420.  */
  1421. ffputline(buf, nbuf)
  1422. register char    buf[];
  1423. {
  1424.     register int    i;
  1425.  
  1426.     for (i=0; i<nbuf; ++i)
  1427.         putc(buf[i]&0xFF, ffp);
  1428.     putc('\n', ffp);
  1429.     if (ferror(ffp) != FALSE) {
  1430.         eprintf("Write I/O error");
  1431.         return (FIOERR);
  1432.     }
  1433.     return (FIOSUC);
  1434. }
  1435.  
  1436. /*
  1437.  * Read a line from a file, and store the bytes
  1438.  * in the supplied buffer. Stop on end of file or end of
  1439.  * line. Don't get upset by files that don't have an end of
  1440.  * line on the last line; this seem to be common on CP/M-86 and
  1441.  * MS-DOS (the suspected culprit is VAX/VMS kermit, but this
  1442.  * has not been confirmed. If this is sufficiently researched
  1443.  * it may be possible to pull this kludge). Delete any CR
  1444.  * followed by an LF. This is mainly for runoff documents,
  1445.  * both on VMS and on Ultrix (they get copied over from
  1446.  * VMS systems with DECnet).
  1447.  */
  1448. ffgetline(buf, nbuf)
  1449. register char    buf[];
  1450. {
  1451.     register int    c;
  1452.     register int    i;
  1453.  
  1454.     i = 0;
  1455.     for (;;) {
  1456.         c = getc(ffp);
  1457.         if (c == '\r') {        /* Delete any non-stray    */
  1458.             c = getc(ffp);        /* carriage returns.    */
  1459.             if (c != '\n') {
  1460.                 if (i >= nbuf-1) {
  1461.                     eprintf("File has long line");
  1462.                     return (FIOERR);
  1463.                 }
  1464.                 buf[i++] = '\r';
  1465.             }
  1466.         }
  1467.         if (c==EOF || c=='\n')        /* End of line.        */
  1468.             break;
  1469.         if (i >= nbuf-1) {
  1470.             eprintf("File has long line");
  1471.             return (FIOERR);
  1472.         }
  1473.         buf[i++] = c;
  1474.     }
  1475.     if (c == EOF) {                /* End of file.        */
  1476.         if (ferror(ffp) != FALSE) {
  1477.             eprintf("File read error");
  1478.             return (FIOERR);
  1479.         }
  1480.         if (i == 0)            /* Don't get upset if    */
  1481.             return (FIOEOF);    /* no newline at EOF.    */
  1482.     }
  1483.     buf[i] = 0;
  1484.     return (FIOSUC);
  1485. }
  1486.  
  1487. /*
  1488.  * VMS has version numbers, so there is
  1489.  * no need for MicroEMACS to bother making its own
  1490.  * flavour of backup copy. Return TRUE so the
  1491.  * caller doesn't quit.
  1492.  */
  1493. fbackupfile(fname)
  1494. char    *fname;
  1495. {
  1496.     return (TRUE);
  1497. }
  1498.  
  1499. /*
  1500.  * The string "fn" is a file name.
  1501.  * Perform any required case adjustments. All sustems
  1502.  * we deal with so far have case insensitive file systems.
  1503.  * We zap everything to lower case. The problem we are trying
  1504.  * to solve is getting 2 buffers holding the same file if
  1505.  * you visit one of them with the "caps lock" key down.
  1506.  * On UNIX file names are dual case, so we leave
  1507.  * everything alone.
  1508.  */
  1509. adjustcase(fn)
  1510. register char    *fn;
  1511. {
  1512.     register int    c;
  1513.  
  1514.     while ((c = *fn) != 0) {
  1515.         if (c>='A' && c<='Z')
  1516.             *fn = c + 'a' - 'A';
  1517.         ++fn;
  1518.     }
  1519. }
  1520. SHAR_EOF
  1521. if test 3410 -ne "`wc -c < 'sys/vms/fileio.c'`"
  1522. then
  1523.     echo shar: error transmitting "'sys/vms/fileio.c'" '(should have been 3410 characters)'
  1524. fi
  1525. fi
  1526. echo shar: extracting "'sys/vms/spawn.c'" '(2289 characters)'
  1527. if test -f 'sys/vms/spawn.c'
  1528. then
  1529.     echo shar: will not over-write existing file "'sys/vms/spawn.c'"
  1530. else
  1531. cat << \SHAR_EOF > 'sys/vms/spawn.c'
  1532. /*
  1533.  * Name:    MicroEMACS
  1534.  *        VAX/VMS spawn a DCL subprocess.
  1535.  * Version:    29
  1536.  * Last edit:    05-Feb-86
  1537.  * By:        rex::conroy
  1538.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1539.  */
  1540. #include    "def.h"
  1541.  
  1542. #include    <ssdef.h>
  1543. #include    <stsdef.h>
  1544. #include    <descrip.h>
  1545. #include    <iodef.h>
  1546.  
  1547. #define    EFN    0                /* Event flag.        */
  1548.  
  1549. extern    int    oldmode[3];            /* In "termio.c".    */
  1550. extern    int    newmode[3];
  1551. extern    short    iochan;
  1552.  
  1553. /*
  1554.  * Create a subjob with a copy
  1555.  * of the command intrepreter in it. When the
  1556.  * command interpreter exits, mark the screen as
  1557.  * garbage so that you do a full repaint. Bound
  1558.  * to "C-C" and called from "C-Z". The message at
  1559.  * the start in VMS puts out a newline. Under
  1560.  * some (unknown) condition, you don't get one
  1561.  * free when DCL starts up.
  1562.  */
  1563. spawncli(f, n, k)
  1564. {
  1565.     ttcolor(CTEXT);                /* Normal color.    */
  1566.     ttwindow(0, nrow-1);            /* Full screen scroll.    */
  1567.     ttmove(nrow-1, 0);            /* Last line.        */
  1568.     eputs("[Starting DCL]");
  1569.     ttputc('\r');
  1570.     ttputc('\n');
  1571.     ttflush();
  1572.     sgarbf = TRUE;
  1573.     return (sys(NULL));            /* NULL => DCL.        */
  1574. }
  1575.  
  1576. /*
  1577.  * Run a command. The "cmd" is a pointer
  1578.  * to a command string, or NULL if you want to run
  1579.  * a copy of DCL in the subjob (this is how the standard
  1580.  * routine LIB$SPAWN works. You have to do wierd stuff
  1581.  * with the terminal on the way in and the way out,
  1582.  * because DCL does not want the channel to be
  1583.  * in raw mode.
  1584.  */
  1585. sys(cmd)
  1586. register char    *cmd;
  1587. {
  1588.     struct    dsc$descriptor    cdsc;
  1589.     struct    dsc$descriptor    *cdscp;
  1590.     long    status;
  1591.     long    substatus;
  1592.     long    iosb[2];
  1593.  
  1594.     status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
  1595.               oldmode, sizeof(oldmode), 0, 0, 0, 0);
  1596.     if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
  1597.         return (FALSE);
  1598.     cdscp = NULL;                /* Assume DCL.        */
  1599.     if (cmd != NULL) {            /* Build descriptor.    */
  1600.         cdsc.dsc$a_pointer = cmd;
  1601.         cdsc.dsc$w_length  = strlen(cmd);
  1602.         cdsc.dsc$b_dtype   = DSC$K_DTYPE_T;
  1603.         cdsc.dsc$b_class   = DSC$K_CLASS_S;
  1604.         cdscp = &cdsc;
  1605.     }
  1606.     status = LIB$SPAWN(cdscp, 0, 0, 0, 0, 0, &substatus, 0, 0, 0);
  1607.     if (status != SS$_NORMAL)
  1608.         substatus = status;
  1609.     status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
  1610.               newmode, sizeof(newmode), 0, 0, 0, 0);
  1611.     if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
  1612.         return (FALSE);
  1613.     if ((substatus&STS$M_SUCCESS) == 0)    /* Command failed.    */
  1614.         return (FALSE);
  1615.     return (TRUE);
  1616. }
  1617. SHAR_EOF
  1618. if test 2289 -ne "`wc -c < 'sys/vms/spawn.c'`"
  1619. then
  1620.     echo shar: error transmitting "'sys/vms/spawn.c'" '(should have been 2289 characters)'
  1621. fi
  1622. fi
  1623. echo shar: extracting "'sys/vms/sysdef.h'" '(715 characters)'
  1624. if test -f 'sys/vms/sysdef.h'
  1625. then
  1626.     echo shar: will not over-write existing file "'sys/vms/sysdef.h'"
  1627. else
  1628. cat << \SHAR_EOF > 'sys/vms/sysdef.h'
  1629. /*
  1630.  * Name:    MicroEMACS
  1631.  *        VAX/VMS system header file.
  1632.  * Version:    29
  1633.  * Last edit:    05-Feb-86
  1634.  * By:        rex::conroy
  1635.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1636.  */
  1637. #include    <ssdef.h>
  1638.  
  1639. #define    PCC    0            /* "[]" works.            */
  1640. #define    KBLOCK    8192            /* Kill grow.            */
  1641. #define    GOOD    (SS$_NORMAL)        /* Good exit status.        */
  1642.  
  1643. /*
  1644.  * Macros used by the buffer name making code.
  1645.  * Start at the end of the file name, scan to the left
  1646.  * until BDC1 (or BDC2, if defined) is reached. The buffer
  1647.  * name starts just to the right of that location, and
  1648.  * stops at end of string (or at the next BDC3 character,
  1649.  * if defined). BDC2 and BDC3 are mainly for VMS.
  1650.  */
  1651. #define    BDC1    ':'            /* Buffer names.        */
  1652. #define    BDC2    ']'
  1653. #define    BDC3    ';'
  1654. SHAR_EOF
  1655. if test 715 -ne "`wc -c < 'sys/vms/sysdef.h'`"
  1656. then
  1657.     echo shar: error transmitting "'sys/vms/sysdef.h'" '(should have been 715 characters)'
  1658. fi
  1659. fi
  1660. echo shar: extracting "'sys/vms/ttyio.c'" '(4573 characters)'
  1661. if test -f 'sys/vms/ttyio.c'
  1662. then
  1663.     echo shar: will not over-write existing file "'sys/vms/ttyio.c'"
  1664. else
  1665. cat << \SHAR_EOF > 'sys/vms/ttyio.c'
  1666. /*
  1667.  * Name:    MicroEMACS
  1668.  *        VAX/VMS terminal I/O.
  1669.  * Version:    29
  1670.  * Last edit:    05-Feb-86
  1671.  * By:        rex::conroy
  1672.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1673.  */
  1674. #include    "def.h"
  1675.  
  1676. #include    <stsdef.h>
  1677. #include    <ssdef.h>
  1678. #include    <descrip.h>
  1679. #include    <iodef.h>
  1680. #include    <ttdef.h>
  1681. #include    <tt2def.h>
  1682.  
  1683. #define    NIBUF    128            /* Probably excessive.        */
  1684. #define    NOBUF    512            /* Not too big for 750/730.    */
  1685. #define    EFN    0            /* Event flag            */
  1686.  
  1687. char    obuf[NOBUF];            /* Output buffer        */
  1688. int    nobuf;                /* # of bytes in above        */
  1689. char    ibuf[NIBUF];            /* Input buffer            */
  1690. int    nibuf;                /* # of bytes in above        */
  1691. int    ibufi;                /* Read index            */
  1692. int    oldmode[3];            /* Old TTY mode bits        */
  1693. int    newmode[3];            /* New TTY mode bits        */
  1694. short    iochan;                /* TTY I/O channel        */
  1695. int    nrow;                /* Terminal size, rows.        */
  1696. int    ncol;                /* Terminal size, columns.    */
  1697.  
  1698. /*
  1699.  * This routines gets called once, to set up the
  1700.  * terminal channel.
  1701.  * On VMS we find the translation of the SYS$COMMAND: logical name,
  1702.  * assign a channel to it, and set it raw. Let VMS handle the flow
  1703.  * control.
  1704.  */
  1705. ttopen()
  1706. {
  1707.     struct    dsc$descriptor    idsc;
  1708.     struct    dsc$descriptor    odsc;
  1709.     char    oname[40];
  1710.     int    iosb[2];
  1711.     int    status;
  1712.  
  1713.     odsc.dsc$a_pointer = "SYS$COMMAND";
  1714.     odsc.dsc$w_length  = strlen(odsc.dsc$a_pointer);
  1715.     odsc.dsc$b_dtype   = DSC$K_DTYPE_T;
  1716.     odsc.dsc$b_class   = DSC$K_CLASS_S;
  1717.     idsc.dsc$b_dtype   = DSC$K_DTYPE_T;
  1718.     idsc.dsc$b_class   = DSC$K_CLASS_S;
  1719.     do {
  1720.         idsc.dsc$a_pointer = odsc.dsc$a_pointer;
  1721.         idsc.dsc$w_length  = odsc.dsc$w_length;
  1722.         odsc.dsc$a_pointer = &oname[0];
  1723.         odsc.dsc$w_length  = sizeof(oname);
  1724.         status = LIB$SYS_TRNLOG(&idsc, &odsc.dsc$w_length, &odsc);
  1725.         if (status!=SS$_NORMAL && status!=SS$_NOTRAN)
  1726.             exit(status);
  1727.         if (oname[0] == 0x1B) {
  1728.             odsc.dsc$a_pointer += 4;
  1729.             odsc.dsc$w_length  -= 4;
  1730.         }
  1731.     } while (status == SS$_NORMAL);
  1732.     status = SYS$ASSIGN(&odsc, &iochan, 0, 0);
  1733.     if (status != SS$_NORMAL)
  1734.         exit(status);
  1735.     status = SYS$QIOW(EFN, iochan, IO$_SENSEMODE, iosb, 0, 0,
  1736.               oldmode, sizeof(oldmode), 0, 0, 0, 0);
  1737.     if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
  1738.         exit(status);
  1739.     nrow = (oldmode[1]>>24) & 0xFF;        /* Length.        */
  1740.     if (nrow > NROW)
  1741.         nrow = NROW;
  1742.     ncol = (oldmode[0]>>16) & 0xFFFF;    /* Width.        */
  1743.     if (ncol > NCOL)
  1744.         ncol = NCOL;
  1745.     newmode[0] = oldmode[0];        /* Only in version 4.    */
  1746.     newmode[1] = oldmode[1] | TT$M_NOECHO | TT$M_TTSYNC;
  1747.     newmode[2] = oldmode[2] | TT2$M_PASTHRU;
  1748.     status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
  1749.               newmode, sizeof(newmode), 0, 0, 0, 0);
  1750.     if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
  1751.         exit(status);
  1752. }
  1753.  
  1754. /*
  1755.  * This function gets called just
  1756.  * before we go back home to the command interpreter.
  1757.  * On VMS it puts the terminal back in a reasonable state.
  1758.  */
  1759. ttclose()
  1760. {
  1761.     int    status;
  1762.     int    iosb[1];
  1763.  
  1764.     ttflush();
  1765.     status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
  1766.              oldmode, sizeof(oldmode), 0, 0, 0, 0);
  1767.     if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
  1768.         exit(status);
  1769.     status = SYS$DASSGN(iochan);
  1770.     if (status != SS$_NORMAL)
  1771.         exit(status);
  1772. }
  1773.  
  1774. /*
  1775.  * Write a character to the display.
  1776.  * On VMS, terminal output is buffered, and
  1777.  * we just put the characters in the big array,
  1778.  * after cheching for overflow.
  1779.  */
  1780. ttputc(c)
  1781. {
  1782.     if (nobuf >= NOBUF)
  1783.         ttflush();
  1784.     obuf[nobuf++] = c;
  1785. }
  1786.  
  1787. /*
  1788.  * This function does the real work of
  1789.  * flushing out buffered I/O on VMS. All
  1790.  * we do is blast out the block with a write call. No status
  1791.  * checking is done on the write, because there isn't anything
  1792.  * clever that can be done, and because you will see the
  1793.  * error as a messed up screen.
  1794.  */
  1795. ttflush()
  1796. {
  1797.     int    iosb[2];
  1798.  
  1799.     if (nobuf != 0) {
  1800.         SYS$QIOW(EFN, iochan, IO$_WRITELBLK|IO$M_NOFORMAT,
  1801.         iosb, 0, 0, obuf, nobuf, 0, 0, 0, 0);
  1802.         nobuf = 0;
  1803.     }
  1804. }
  1805.  
  1806. /*
  1807.  * Read a character from the terminal,
  1808.  * performing no editing and doing no echo at all.
  1809.  * More complex in VMS that almost anyplace else, which
  1810.  * figures.
  1811.  */
  1812. ttgetc()
  1813. {
  1814.     int    status;
  1815.     int    iosb[2];
  1816.     int    term[2];
  1817.  
  1818.     term[0] = 0;
  1819.     term[1] = 0;
  1820.     while (ibufi >= nibuf) {
  1821.         ibufi   = 0;
  1822.         status = SYS$QIOW(EFN, iochan, IO$_READLBLK|IO$M_TIMED,
  1823.              iosb, 0, 0, ibuf, NIBUF, 0, term, 0, 0);
  1824.         if (status != SS$_NORMAL)
  1825.             continue;
  1826.         status = iosb[0] & 0xFFFF;
  1827.         if (status!=SS$_NORMAL && status!=SS$_TIMEOUT)
  1828.             continue;
  1829.         nibuf = (iosb[0]>>16) + (iosb[1]>>16);
  1830.         if (nibuf == 0) {
  1831.             status = SYS$QIOW(EFN, iochan, IO$_READLBLK,
  1832.                 iosb, 0, 0, ibuf, 1, 0, term, 0, 0);
  1833.             if (status != SS$_NORMAL)
  1834.                 continue;
  1835.             if ((iosb[0]&0xFFFF) != SS$_NORMAL)
  1836.                 continue;
  1837.             nibuf = (iosb[0]>>16) + (iosb[1]>>16);
  1838.         }
  1839.     }
  1840.     return (ibuf[ibufi++] & 0xFF);
  1841. }
  1842. SHAR_EOF
  1843. if test 4573 -ne "`wc -c < 'sys/vms/ttyio.c'`"
  1844. then
  1845.     echo shar: error transmitting "'sys/vms/ttyio.c'" '(should have been 4573 characters)'
  1846. fi
  1847. fi
  1848. echo shar: extracting "'sys/vms/uemacs.mms'" '(2633 characters)'
  1849. if test -f 'sys/vms/uemacs.mms'
  1850. then
  1851.     echo shar: will not over-write existing file "'sys/vms/uemacs.mms'"
  1852. else
  1853. cat << \SHAR_EOF > 'sys/vms/uemacs.mms'
  1854. ! MICROEMACS BUILD FILE.
  1855. ! VAX/VMS.
  1856. ! IS THERE A BETTER WAY TO DEAL WITH THE COMMAND FILES,
  1857. ! GIVEN THAT YOU CANNOT SAY "-I" ON THE COMMAND LINE OF THE
  1858. ! CC COMMAND?
  1859.  
  1860. SYS    =    [.SYS.VMS]
  1861. TTY    =    [.TTY.ANSI]
  1862.  
  1863. .FIRST
  1864.     COPY $(SYS)SYSDEF.H []SYSDEF.H
  1865.     COPY $(TTY)TTYDEF.H []TTYDEF.H
  1866.  
  1867. .LAST
  1868.     DEL []SYSDEF.H;*
  1869.     DEL []TTYDEF.H;*
  1870.  
  1871. ! LINK.
  1872.  
  1873. UEMACS.EXE :    BASIC.OBJ    BUFFER.OBJ    CINFO.OBJ    DISPLAY.OBJ -
  1874.         ECHO.OBJ    EXTEND.OBJ    FILE.OBJ    KBD.OBJ -
  1875.         LINE.OBJ    MAIN.OBJ    RANDOM.OBJ    REGION.OBJ -
  1876.         SEARCH.OBJ    SYMBOL.OBJ    VERSION.OBJ    WINDOW.OBJ -
  1877.         WORD.OBJ    FILEIO.OBJ    TTYIO.OBJ    SPAWN.OBJ -
  1878.         TTY.OBJ        TTYKBD.OBJ
  1879.     LINK/EXE=UEMACS.EXE/NOMAP -
  1880.         BASIC.OBJ,    BUFFER.OBJ,    CINFO.OBJ,    DISPLAY.OBJ, -
  1881.         ECHO.OBJ,    EXTEND.OBJ,    FILE.OBJ,    KBD.OBJ, -
  1882.         LINE.OBJ,    MAIN.OBJ,    RANDOM.OBJ,    REGION.OBJ, -
  1883.         SEARCH.OBJ,    SYMBOL.OBJ,    VERSION.OBJ,    WINDOW.OBJ, -
  1884.         WORD.OBJ,    FILEIO.OBJ,    TTYIO.OBJ,    SPAWN.OBJ, -
  1885.         TTY.OBJ,    TTYKBD.OBJ,    SYS$LIBRARY:VAXCRTL.OLB/LIB
  1886.     PURGE/LOG
  1887.  
  1888. ! COMMON.
  1889.  
  1890. BASIC.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H BASIC.C
  1891.  
  1892. BUFFER.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H BUFFER.C
  1893.  
  1894. CINFO.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H CINFO.C
  1895.  
  1896. DISPLAY.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H DISPLAY.C
  1897.  
  1898. ECHO.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H ECHO.C
  1899.  
  1900. EXTEND.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H EXTEND.C
  1901.  
  1902. FILE.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H FILE.C
  1903.  
  1904. KBD.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H KBD.C
  1905.  
  1906. LINE.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H LINE.C
  1907.  
  1908. MAIN.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H MAIN.C
  1909.  
  1910. RANDOM.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H RANDOM.C
  1911.  
  1912. REGION.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H REGION.C
  1913.  
  1914. SEARCH.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H SEARCH.C
  1915.  
  1916. SYMBOL.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H SYMBOL.C
  1917.  
  1918. VERSION.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H VERSION.C
  1919.  
  1920. WINDOW.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H WINDOW.C
  1921.  
  1922. WORD.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H WORD.C
  1923.  
  1924. ! SYSTEM.
  1925.  
  1926. FILEIO.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H $(SYS)FILEIO.C
  1927.     COPY $(SYS)FILEIO.C []FILEIO.C
  1928.     CC/OBJECT=FILEIO.OBJ FILEIO.C
  1929.     DELETE FILEIO.C;*
  1930.  
  1931. TTYIO.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H $(SYS)TTYIO.C
  1932.     COPY $(SYS)TTYIO.C []TTYIO.C
  1933.     CC/OBJECT=TTYIO.OBJ TTYIO.C
  1934.     DELETE TTYIO.C;*
  1935.  
  1936. SPAWN.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H $(SYS)SPAWN.C
  1937.     COPY $(SYS)SPAWN.C []SPAWN.C
  1938.     CC/OBJECT=SPAWN.OBJ SPAWN.C
  1939.     DELETE SPAWN.C;*
  1940.  
  1941. ! TERMINAL.
  1942.  
  1943. TTY.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H $(TTY)TTY.C
  1944.     COPY $(TTY)TTY.C []TTY.C
  1945.     CC/OBJECT=TTY.OBJ TTY.C
  1946.     DELETE TTY.C;*
  1947.  
  1948. TTYKBD.OBJ :    DEF.H $(SYS)SYSDEF.H $(TTY)TTYDEF.H $(TTY)TTYKBD.C
  1949.     COPY $(TTY)TTYKBD.C []TTYKBD.C
  1950.     CC/OBJECT=TTYKBD.OBJ TTYKBD.C
  1951.     DELETE TTYKBD.C;*
  1952. SHAR_EOF
  1953. if test 2633 -ne "`wc -c < 'sys/vms/uemacs.mms'`"
  1954. then
  1955.     echo shar: error transmitting "'sys/vms/uemacs.mms'" '(should have been 2633 characters)'
  1956. fi
  1957. fi
  1958. echo shar: done with directory "'sys/vms'"
  1959. if test ! -d 'sys/msdos'
  1960. then
  1961.     echo shar: creating directory "'sys/msdos'"
  1962.     mkdir 'sys/msdos'
  1963. fi
  1964. echo shar: extracting "'sys/msdos/fileio.c'" '(3264 characters)'
  1965. if test -f 'sys/msdos/fileio.c'
  1966. then
  1967.     echo shar: will not over-write existing file "'sys/msdos/fileio.c'"
  1968. else
  1969. cat << \SHAR_EOF > 'sys/msdos/fileio.c'
  1970. /*
  1971.  * Name:    MicroEMACS
  1972.  *        MS-DOS file I/O.
  1973.  * Version:    29
  1974.  * Last edit:    05-Feb-86
  1975.  * By:        rex::conroy
  1976.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  1977.  */
  1978. #include    "def.h"
  1979.  
  1980. static    FILE    *ffp;
  1981.  
  1982. /*
  1983.  * Open a file for reading.
  1984.  */
  1985. ffropen(fn)
  1986. char    *fn;
  1987. {
  1988.     if ((ffp=fopen(fn, "r")) == NULL)
  1989.         return (FIOFNF);
  1990.     return (FIOSUC);
  1991. }
  1992.  
  1993. /*
  1994.  * Open a file for writing.
  1995.  * Return TRUE if all is well, and
  1996.  * FALSE on error (cannot create).
  1997.  */
  1998. ffwopen(fn)
  1999. char    *fn;
  2000. {
  2001.     if ((ffp=fopen(fn, "w")) == NULL) {
  2002.         eprintf("Cannot open file for writing");
  2003.         return (FIOERR);
  2004.     }
  2005.     return (FIOSUC);
  2006. }
  2007.  
  2008. /*
  2009.  * Close a file.
  2010.  * Should look at the status.
  2011.  */
  2012. ffclose()
  2013. {
  2014.     fclose(ffp);
  2015.     return (FIOSUC);
  2016. }
  2017.  
  2018. /*
  2019.  * Write a line to the already
  2020.  * opened file. The "buf" points to the
  2021.  * buffer, and the "nbuf" is its length, less
  2022.  * the free newline. Return the status.
  2023.  * Check only at the newline.
  2024.  */
  2025. ffputline(buf, nbuf)
  2026. register char    buf[];
  2027. {
  2028.     register int    i;
  2029.  
  2030.     for (i=0; i<nbuf; ++i)
  2031.         putc(buf[i]&0xFF, ffp);
  2032.     putc('\n', ffp);
  2033.     if (ferror(ffp) != FALSE) {
  2034.         eprintf("Write I/O error");
  2035.         return (FIOERR);
  2036.     }
  2037.     return (FIOSUC);
  2038. }
  2039.  
  2040. /*
  2041.  * Read a line from a file, and store the bytes
  2042.  * in the supplied buffer. Stop on end of file or end of
  2043.  * line. Don't get upset by files that don't have an end of
  2044.  * line on the last line; this seem to be common on CP/M-86 and
  2045.  * MS-DOS (the suspected culprit is VAX/VMS kermit, but this
  2046.  * has not been confirmed. If this is sufficiently researched
  2047.  * it may be possible to pull this kludge). Delete any CR
  2048.  * followed by an LF. This is mainly for runoff documents,
  2049.  * both on VMS and on Ultrix (they get copied over from
  2050.  * VMS systems with DECnet).
  2051.  */
  2052. ffgetline(buf, nbuf)
  2053. register char    buf[];
  2054. {
  2055.     register int    c;
  2056.     register int    i;
  2057.  
  2058.     i = 0;
  2059.     for (;;) {
  2060.         c = getc(ffp);
  2061.         if (c == '\r') {        /* Delete any non-stray    */
  2062.             c = getc(ffp);        /* carriage returns.    */
  2063.             if (c != '\n') {
  2064.                 if (i >= nbuf-1) {
  2065.                     eprintf("File has long line");
  2066.                     return (FIOERR);
  2067.                 }
  2068.                 buf[i++] = '\r';
  2069.             }
  2070.         }
  2071.         if (c==EOF || c=='\n')        /* End of line.        */
  2072.             break;
  2073.         if (i >= nbuf-1) {
  2074.             eprintf("File has long line");
  2075.             return (FIOERR);
  2076.         }
  2077.         buf[i++] = c;
  2078.     }
  2079.     if (c == EOF) {                /* End of file.        */
  2080.         if (ferror(ffp) != FALSE) {
  2081.             eprintf("File read error");
  2082.             return (FIOERR);
  2083.         }
  2084.         if (i == 0)            /* Don't get upset if    */
  2085.             return (FIOEOF);    /* no newline at EOF.    */
  2086.     }
  2087.     buf[i] = 0;
  2088.     return (FIOSUC);
  2089. }
  2090.  
  2091. /*
  2092.  * Some backup user on MS-DOS might want
  2093.  * to determine some rule for doing backups on that
  2094.  * system, and fix this. I don't use MS-DOS, so I don't
  2095.  * know what the right rules would be. Return TRUE so
  2096.  * the caller does not abort a write.
  2097.  */
  2098. fbackupfile(fname)
  2099. char    *fname;
  2100. {
  2101.     return (TRUE);                /* Hack.        */
  2102. }
  2103.  
  2104. /*
  2105.  * The string "fn" is a file name.
  2106.  * Perform any required case adjustments. All sustems
  2107.  * we deal with so far have case insensitive file systems.
  2108.  * We zap everything to lower case. The problem we are trying
  2109.  * to solve is getting 2 buffers holding the same file if
  2110.  * you visit one of them with the "caps lock" key down.
  2111.  * On UNIX file names are dual case, so we leave
  2112.  * everything alone.
  2113.  */
  2114. adjustcase(fn)
  2115. register char    *fn;
  2116. {
  2117.     register int    c;
  2118.  
  2119.     while ((c = *fn) != 0) {
  2120.         if (c>='A' && c<='Z')
  2121.             *fn = c + 'a' - 'A';
  2122.         ++fn;
  2123.     }
  2124. }
  2125. SHAR_EOF
  2126. if test 3264 -ne "`wc -c < 'sys/msdos/fileio.c'`"
  2127. then
  2128.     echo shar: error transmitting "'sys/msdos/fileio.c'" '(should have been 3264 characters)'
  2129. fi
  2130. fi
  2131. echo shar: extracting "'sys/msdos/putline.asm'" '(1946 characters)'
  2132. if test -f 'sys/msdos/putline.asm'
  2133. then
  2134.     echo shar: will not over-write existing file "'sys/msdos/putline.asm'"
  2135. else
  2136. cat << \SHAR_EOF > 'sys/msdos/putline.asm'
  2137. ; High speed screen update for Rainbow.
  2138. ; putline(row, col, buf);
  2139. ; Row and column are origin 1.
  2140. ; The buf is a pointer to an array of characters.
  2141. ; It won't write past the end of the line in
  2142. ; the video RAM; it looks for the FF at the end
  2143. ; of the line.
  2144. ; This routine by Bob McNamara.
  2145. ; put into large model .ASM format by Rich Ellison
  2146.  
  2147. putline_code    segment byte    public    'code'
  2148. extrn    tthue_:word
  2149.     public    putline_
  2150.     assume    cs:putline_code,ds:nothing,es:nothing,ss:nothing
  2151.  
  2152. ScrSeg  equ    0ee00h
  2153. ScrPtr    equ    3
  2154. CMODE    equ    2
  2155.  
  2156. putline_    proc    far    ; putline(Row, Col, Buf)    /* fast video */
  2157. Row    equ    10        ; int    Row;            /*   row addr */
  2158. Col    equ    12        ; int    Col;            /*   col addr */
  2159. Buf    equ    14        ; char    *Buf;            /*   data     */
  2160.                 ; {
  2161.     push    si
  2162.     push    di
  2163.     push    bp
  2164.     mov    bp,sp
  2165.     push    ds
  2166.     push    es
  2167.     mov    ax,ScrSeg        ;point extra segment into screen RAM
  2168.     mov    es,ax
  2169.     mov    di,es:ScrPtr+1        ;di <- base line address
  2170.     and    di,0fffh
  2171.     mov    al,0ffh
  2172.     cld
  2173.  
  2174.     mov    dx,[bp+Row]        ;row number to write (dx)
  2175.     lds    si,dword ptr[bp+Buf]    ;string to be moved ds:(si)
  2176.     mov    bx,[bp+Col]        ;column number to start at (bx)
  2177.     dec    bx            ;column number starts at 1
  2178.     dec    dx            ;row number starts at 1
  2179.     jz    l2
  2180. l1:    mov    cx,140
  2181.     repnz scasb
  2182.     mov    di,es:[di]        ;pointer to next line (di)
  2183.     and    di,0fffh
  2184.     dec    dx
  2185.     jnz    l1
  2186. l2:    add    di,bx            ;di -> offset in row
  2187.     push    di
  2188.  
  2189. l3:    cmp    al,es:[di]
  2190.     jz    l4
  2191.     movsb
  2192.     cmp    al,es:[di]
  2193.     jz    l4
  2194.     movsb
  2195.     cmp    al,es:[di]
  2196.     jz    l4
  2197.     movsb
  2198.     cmp    al,es:[di]
  2199.     jz    l4
  2200.     movsb
  2201.     cmp    al,es:[di]
  2202.     jz    l4
  2203.     movsb
  2204.     cmp    al,es:[di]
  2205.     jz    l4
  2206.     movsb
  2207.     cmp    al,es:[di]
  2208.     jz    l4
  2209.     movsb
  2210.     cmp    al,es:[di]
  2211.     jz    l4
  2212.     movsb
  2213.     jmp    l3
  2214. l4:
  2215.     pop    cx
  2216.     mov    ax,cx
  2217.     sub    di,cx
  2218.     mov    cx,di            ;cx contains repeat count
  2219.     add    ax,1000h        ;point into attribute portion of RAM
  2220.     mov    di,ax            ;di contains pointer into attr. RAM
  2221.     mov    ax,0fh            ;assume rev. video
  2222.     cmp    word ptr tthue_,CMODE    ;is this for mode line?
  2223.     jz    l5            ;yes
  2224.     mov    ax,0eh            ;no, clear attributes
  2225. l5:
  2226.     rep stosb
  2227.  
  2228.     pop    es
  2229.     pop    ds
  2230.     pop    bp
  2231.     pop    di
  2232.     pop    si
  2233.     ret
  2234. putline_    endp
  2235.  
  2236.     putline_code    ends
  2237.     end
  2238. SHAR_EOF
  2239. if test 1946 -ne "`wc -c < 'sys/msdos/putline.asm'`"
  2240. then
  2241.     echo shar: error transmitting "'sys/msdos/putline.asm'" '(should have been 1946 characters)'
  2242. fi
  2243. fi
  2244. echo shar: extracting "'sys/msdos/putline.s'" '(1221 characters)'
  2245. if test -f 'sys/msdos/putline.s'
  2246. then
  2247.     echo shar: will not over-write existing file "'sys/msdos/putline.s'"
  2248. else
  2249. cat << \SHAR_EOF > 'sys/msdos/putline.s'
  2250. / High speed screen update for Rainbow.
  2251. / MWC-86 has this in CP/M-86 but not in MS-DOS.
  2252. / putline(row, col, buf);
  2253. / Row and column are origin 1.
  2254. / The buf is a pointer to an array of characters.
  2255. / It won't write past the end of the line in
  2256. / the video RAM; it looks for the FF at the end
  2257. / of the line.
  2258. / This routine by Bob McNamara.
  2259.  
  2260.     .globl    putline_
  2261.  
  2262. Scr_Seg = 0xEE00
  2263. ScrPtr    = 3
  2264.  
  2265. putline_:
  2266.     push    si
  2267.     push    di
  2268.     push    es
  2269.     mov    ax,$Scr_Seg    /point our extra segment into screen RAM
  2270.     mov    es,ax
  2271.     mov    di,es:ScrPtr+1    /di <- base line address
  2272.     and    di,$0x0fff
  2273.     movb    al,$0xff
  2274.     cld
  2275.  
  2276.     mov    bx,sp
  2277.     mov    dx,8(bx)    /dx = row number to write
  2278.     mov    si,12(bx)    /si = string to be moved
  2279.     mov    bx,10(bx)    /bx = column number to start at
  2280.     dec    bx        /column number starts at 1
  2281.     dec    dx        /row number starts at 1 too
  2282.     jz    2f
  2283. 1:
  2284.     mov    cx,$140
  2285.     repnz scasb
  2286.     mov    di,es:(di)    /di = pointer to next line
  2287.     and    di,$0x0fff
  2288.     dec    dx
  2289.     jnz    1b
  2290. 2:    
  2291.     add    di,bx        /di -> offset in row
  2292. 3:
  2293.     cmpb    al,es:(di)
  2294.     jz    4f
  2295.     movsb
  2296.     cmpb    al,es:(di)
  2297.     jz    4f
  2298.     movsb
  2299.     cmpb    al,es:(di)
  2300.     jz    4f
  2301.     movsb
  2302.     cmpb    al,es:(di)
  2303.     jz    4f
  2304.     movsb
  2305.     cmpb    al,es:(di)
  2306.     jz    4f
  2307.     movsb
  2308.     cmpb    al,es:(di)
  2309.     jz    4f
  2310.     movsb
  2311.     cmpb    al,es:(di)
  2312.     jz    4f
  2313.     movsb
  2314.     cmpb    al,es:(di)
  2315.     jz    4f
  2316.     movsb
  2317.     jmp    3b
  2318. 4:
  2319.     pop    es
  2320.     pop    di
  2321.     pop    si
  2322.     ret
  2323. SHAR_EOF
  2324. if test 1221 -ne "`wc -c < 'sys/msdos/putline.s'`"
  2325. then
  2326.     echo shar: error transmitting "'sys/msdos/putline.s'" '(should have been 1221 characters)'
  2327. fi
  2328. fi
  2329. echo shar: extracting "'sys/msdos/spawn.c'" '(1603 characters)'
  2330. if test -f 'sys/msdos/spawn.c'
  2331. then
  2332.     echo shar: will not over-write existing file "'sys/msdos/spawn.c'"
  2333. else
  2334. cat << \SHAR_EOF > 'sys/msdos/spawn.c'
  2335. /*
  2336.  * Name:    MicroEMACS
  2337.  *        MS-DOS spawn command.com
  2338.  * Version:    29
  2339.  * Last edit:    05-Feb-86
  2340.  * By:        rex::conroy
  2341.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  2342.  */
  2343. #include    "def.h"
  2344.  
  2345. #include    <dos.h>
  2346.  
  2347. #if    !LARGE
  2348. char    *cspec    = NULL;                /* Command string.    */
  2349. #endif
  2350.  
  2351. /*
  2352.  * Create a subjob with a copy
  2353.  * of the command intrepreter in it. When the
  2354.  * command interpreter exits, mark the screen as
  2355.  * garbage so that you do a full repaint. Bound
  2356.  * to "C-C" and called from "C-Z".
  2357.  */
  2358. spawncli(f, n, k)
  2359. {
  2360. #if    LARGE
  2361.     eprintf("Not in large model MS-DOS");
  2362.     return (FALSE);
  2363. #else
  2364.     ttcolor(CTEXT);                /* Normal color.    */
  2365.     ttwindow(0, nrow-1);            /* Full screen scroll.    */
  2366.     ttmove(nrow-1, 0);            /* Last line.        */
  2367.     ttflush();
  2368.     if (cspec == NULL) {            /* Try to find it.    */
  2369.         cspec = getenv("COMSPEC");
  2370.         if (cspec == NULL)
  2371.             cspec = "A:COMMAND.COM";
  2372.     }
  2373.     sys(cspec, "");                /* Run CLI.        */
  2374.     sgarbf = TRUE;
  2375.     return(TRUE);
  2376. #endif
  2377. }
  2378.  
  2379. #if    !LARGE
  2380. /*
  2381.  * This routine, once again
  2382.  * by Bob McNamara, is a C translation
  2383.  * of the "system" routine in the MWC-86 run
  2384.  * time library. It differs from the "system" routine
  2385.  * in that it does not unconditionally append the
  2386.  * string ".exe" to the end of the command name.
  2387.  * We needed to do this because we want to be
  2388.  * able to spawn off "command.com". We really do
  2389.  * not understand what it does, but if you don't
  2390.  * do it exactly "malloc" starts doing very
  2391.  * very strange things.
  2392.  */
  2393. sys(cmd, tail)
  2394. char    *cmd;
  2395. char    *tail;
  2396. {
  2397.     register unsigned n;
  2398.     extern   char      *__end;
  2399.  
  2400.     n = __end + 15;
  2401.     n >>= 4;
  2402.     n = ((n + dsreg() + 16) & 0xFFF0) + 16;
  2403.     return(execall(cmd, tail, n));
  2404. }
  2405. #endif
  2406. SHAR_EOF
  2407. if test 1603 -ne "`wc -c < 'sys/msdos/spawn.c'`"
  2408. then
  2409.     echo shar: error transmitting "'sys/msdos/spawn.c'" '(should have been 1603 characters)'
  2410. fi
  2411. fi
  2412. echo shar: extracting "'sys/msdos/sysdef.h'" '(609 characters)'
  2413. if test -f 'sys/msdos/sysdef.h'
  2414. then
  2415.     echo shar: will not over-write existing file "'sys/msdos/sysdef.h'"
  2416. else
  2417. cat << \SHAR_EOF > 'sys/msdos/sysdef.h'
  2418. /*
  2419.  * Name:    MicroEMACS
  2420.  *        MS-DOS system header file.
  2421.  * Version:    29
  2422.  * Last edit:    05-Feb-86
  2423.  * By:        rex::conroy
  2424.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  2425.  */
  2426. #define    LARGE    0            /* Large model.            */
  2427. #define    PCC    0            /* "[]" will work.        */
  2428.  
  2429. /*
  2430.  * Macros used by the buffer name making code.
  2431.  * Start at the end of the file name, scan to the left
  2432.  * until BDC1 (or BDC2, if defined) is reached. The buffer
  2433.  * name starts just to the right of that location, and
  2434.  * stops at end of string (or at the next BDC3 character,
  2435.  * if defined). BDC2 and BDC3 are mainly for VMS.
  2436.  */
  2437. #define    BDC1    ':'            /* Buffer names.        */
  2438. SHAR_EOF
  2439. if test 609 -ne "`wc -c < 'sys/msdos/sysdef.h'`"
  2440. then
  2441.     echo shar: error transmitting "'sys/msdos/sysdef.h'" '(should have been 609 characters)'
  2442. fi
  2443. fi
  2444. echo shar: extracting "'sys/msdos/ttyio.c'" '(607 characters)'
  2445. if test -f 'sys/msdos/ttyio.c'
  2446. then
  2447.     echo shar: will not over-write existing file "'sys/msdos/ttyio.c'"
  2448. else
  2449. cat << \SHAR_EOF > 'sys/msdos/ttyio.c'
  2450. /*
  2451.  * Name:    MicroEMACS
  2452.  *        MS-DOS terminal I/O.
  2453.  * Version:    29
  2454.  * Last edit:    05-Feb-86
  2455.  * By:        rex::conroy
  2456.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  2457.  */
  2458. #include    "def.h"
  2459.  
  2460. #include    <dos.h>
  2461.  
  2462. int    nrow;                /* Terminal size, rows.        */
  2463. int    ncol;                /* Terminal size, columns.    */
  2464.  
  2465. /*
  2466.  * Initialization.
  2467.  * Almost no operation in MS-DOS.
  2468.  */
  2469. ttopen()
  2470. {
  2471.     nrow = NROW;
  2472.     ncol = NCOL;
  2473. }
  2474.  
  2475. /*
  2476.  * No operation in MS-DOS.
  2477.  */
  2478. ttclose()
  2479. {
  2480. }
  2481.  
  2482. /*
  2483.  * Write character.
  2484.  */
  2485. ttputc(c)
  2486. {
  2487.     dosb(CONDIO, c, 0);
  2488. }
  2489.  
  2490. /*
  2491.  * No operation in MS-DOS.
  2492.  */
  2493. ttflush()
  2494. {
  2495. }
  2496.  
  2497. /*
  2498.  * Read character.
  2499.  */
  2500. ttgetc()
  2501. {
  2502.     return (dosb(CONRAW,  0, 0));
  2503. }
  2504. SHAR_EOF
  2505. if test 607 -ne "`wc -c < 'sys/msdos/ttyio.c'`"
  2506. then
  2507.     echo shar: error transmitting "'sys/msdos/ttyio.c'" '(should have been 607 characters)'
  2508. fi
  2509. fi
  2510. echo shar: done with directory "'sys/msdos'"
  2511. echo shar: done with directory "'sys'"
  2512. exit 0
  2513. #    End of shell archive
  2514.